#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time    : 2025/9/16 10:45
# @Author  : Chenmm
# @File    : del_file.py.py
# @desc    : 从硬盘上物理删除本地文件

from fastapi import BackgroundTasks
from application.settings import STATIC_ROOT, STATIC_URL
import os


def del_file(file_url: str) -> bool:
    file_path = file_url.replace(STATIC_URL, STATIC_ROOT)
    if os.path.exists(file_path):
        os.remove(file_path)
        return True
    else:
        return False